from openai import OpenAI
import os

# 使用DeepSeek-chat模型作为chatmodel
client = OpenAI(api_key=os.environ.get("DEEPSEEK_API_KEY"),base_url=os.environ.get("DEEPSEEK_BASE_URL"))

print([model.id for model in client.models.list().data])

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "user", "content": "请你介绍一下什么是人工智能"},
    ],
    temperature=0.7,
    max_tokens=1024,
    stream=True
)


for chunk in response:
    print(chunk.choices[0].delta.content,end="",flush=True)

